 <!-- Example table --> <div class="container_12"> 
      <div class="module">
                     <h2><span><?php echo $_title;?></span></h2>
                        
                     <div class="module-body">
                         <div style="margin-top:13px;">
                        <?php
                        if(isset($errMsg)){?>
                        <span class="notification"><?php echo $_MESSESGE[$errMsg];?></span>
                        <?php }?></div>
                        
                        <form id="adminForm" name="adminForm" action="" method="post">
                        
                            <p>
                                <label>Role Name<span class="star">*</span></label>
                                <div id="availability_info_loginid"></div>
                                <input type="text" class="input-short" name="group_name" id="group_name" value="<?php echo $_POST['group_name'];?>" />
                                <!-- <span class="notification-input ni-correct">This is correct, thanks!</span> -->
                            </p>
                            
                            <p>
                                <label>Assign Modules</label>
                                 <table style="border-bottom: 0px;">
                                <?php
                                    $result = CommonUtility::getData($parms=null, $table='admin_modules', $condition=array('status'=>'1'));
                                    $i = 0;                                    
                                    foreach( $result as $row ){
                                        print($i%4==0 ? '</tr><tr>' : '');
                                        echo '<td>';
                                        if( @in_array($row['id'], $_POST['modules'])){
                                            echo '&nbsp;&nbsp;<input type="checkbox" name="modules[]" value="'.$row['id'].'" checked >&nbsp;'.$row['module_name'];
                                        }else{
                                            echo '&nbsp;&nbsp;<input type="checkbox" name="modules[]" value="'.$row['id'].'" >&nbsp;'.$row['module_name'];
                                        }
                                            //echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="op_'.$row['id'].'[]" value="1" >&nbsp;List';
                                            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="op_'.$row['id'].'[]" value="2">&nbsp;Add';
                                            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="op_'.$row['id'].'[]" value="3">&nbsp;Edit';
                                            echo '<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="op_'.$row['id'].'[]" value="4">&nbsp;Delete';
                                        $i++;
                                        echo '</td>';
                                    }
                                    print($i%4==0 ? '</tr>' : ($i%4==3 ? '<td></td>' : ($i%4==2 ? '<td></td><td></td>' : '<td></td><td></td>' ) ) );
                                ?>
                                </table>
                                
                            </p>
                            

                            <fieldset>
                                <input class="submit-green" type="submit" name="submit" value="Submit" /> 
                               <input class="submit-gray" type="button" value="Cancel" onclick="javascript: window.location='<?php echo _SITE_ADMIN_URL_?>'+'wedding/wedding_slab_mng.php';" />
                            </fieldset>
                        </form>
                     </div> <!-- End .module-body -->

                </div>  <!-- End .module -->
                </div>
                <div style="clear:both;"></div>
                
<script type="text/javascript">
$().ready(function() {
    var root_path = '<?php echo _SITE_ADMIN_URL_?>';
    var table = 'access_group';
    var field = 'group_name';
    
    $('#group_name').keyup(function(){ 
            var field_value = $(this).val();
            path = root_path+'ajax/getGeo.php?type=check_availability&table='+table+'&field='+field+'&field_value='+field_value;
            $.ajax({url: path,    
                success: function(response) {
                    $('#availability_loading').hide();
                    $('#availability_info_loginid').html(response);
                }
            });
        });
        
        
    $("#adminForm").validate({
        rules: {
            group_name: "required"
        },
        messages: {
            group_name: "Please enter Role name."
        }
    });
    
    $("input:checkbox[name='modules[]']").click(function(){        
        var ctrl = 'op_'+this.value+'[]';    
        
        if( this.checked) {  // check all subbordinates            
            $('input:checkbox[name='+ctrl+']').each(function(){                
                this.checked = "checked";
            });
            
        }else{              // uncheck all subbordinates
            $('input:checkbox[name='+ctrl+']').each(function(){                
                this.checked = false;
            });            
        }
    });

});

</script>                                